Godot: 継承したクラスからSuperクラスのメソッドを呼ぶ
Godot Engineで継承元のクラスの method を呼びたい場合
Godot 4.0からは、superキーワードを使う
https://shaggydev.com/2022/10/24/gdscript1-to-gdscript2/
code:gd
class MyClass:
func say_hello():
print('Hello!')
func say_goodbye():
print('Later!')
class MyOtherClass extends MyClass:
func say_hello():
super()
print('Howdy!')
super.say_goodbye()
Godot 3.xのやり方
extends MyClass で継承したクラスから、MyClassのsuper methods を実行したい場合
.method名で実行できる
例
code:py
func _ready():
._ready()
// ここに自分の処理
._ready()で親クラスの _ready を呼んでいる